package cn.com.youjile.listener;

import cn.com.youjile.utils.SpringUtil;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * @Author youjile
 * @CreateDate 2021/3/12
 * @Describe 缓存ApplicationContext到SpringUtil类中，方便后期使用
 */
public class MainBusiListeners implements ApplicationListener<ContextRefreshedEvent> {

    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        SpringUtil.setApplicationContext(contextRefreshedEvent.getApplicationContext());
    }

}
